package com.zmm.myyimixian.util;

import android.content.Context;
import android.content.Intent;

import com.zmm.myyimixian.ui.activity.address.AddressActivity;
import com.zmm.myyimixian.ui.activity.address.ModificationAddressActivity;
import com.zmm.myyimixian.ui.activity.address.NewAddressActivity;
import com.zmm.myyimixian.ui.activity.login.BoundActivity;
import com.zmm.myyimixian.ui.activity.login.LoginActivity;
import com.zmm.myyimixian.ui.activity.login.RegActivity;
import com.zmm.myyimixian.ui.activity.main.MainActivity;
import com.zmm.myyimixian.ui.activity.main.home.HomeBoosActivity;
import com.zmm.myyimixian.ui.activity.main.home.ListViewActivity;
import com.zmm.myyimixian.ui.activity.main.home.ListViewOneActivity;
import com.zmm.myyimixian.ui.activity.personal.PersonalActivity;
import com.zmm.myyimixian.ui.activity.search.view.SearchActivity;
import com.zmm.myyimixian.ui.activity.setting.SettingActivity;
import com.zmm.myyimixian.ui.activity.shopping.ShoppingCartActivity;
import com.zmm.myyimixian.ui.activity.web.WebActivity;

import java.io.Serializable;

/**
 * Created by Administrator on 2016/10/21 0021.
 */

public class UIManager {
    /**
     * startWebActivity
     * @param context
     */
    public static void startWebActivity(Context context, String path, String title){
        Intent intent = new Intent();
        intent.putExtra("path",path);
        intent.putExtra("title",title);
        intent.setClass(context, WebActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开个人中心
     */
    public static void startPersonalActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, PersonalActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开登录界面
     */
    public static void startLoginActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, LoginActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开设置界面
     */
    public static void startSettingActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, SettingActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开注册界面
     */
    public static void startRegActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, RegActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开购物车界面
     */
    public static void startShoppingCartActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, ShoppingCartActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开绑定手机号界面
     */
    public static void startBoundActivity(Context context, Serializable value){
        Intent intent = new Intent();
        intent.putExtra("user",value);
        intent.setClass(context, BoundActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开管理收货地址界面
     */
    public static void startAddressActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, AddressActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开搜索界面
     */
    public static void startSearchActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, SearchActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开主界面
     */
    public static void startMain(Context context){
        Intent intent = new Intent(context,MainActivity.class);
        intent.putExtra("login","login");
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(intent);
    }

    /**
     * 打开商品详情页面
     */
    public static void startListViewOneActivity(Context context,String url){
        Intent intent = new Intent();
        intent.putExtra("url",url);
        intent.setClass(context, ListViewOneActivity.class);
        context.startActivity(intent);
    }

    /**
     * 跳转到item详情界面
     */
    public static void startDetails(Context context, String desc_url){
        desc_url = desc_url.substring(desc_url.length() - 5, desc_url.length());
        Intent intent = new Intent(context,ListViewOneActivity.class);
        intent.putExtra("url",desc_url);
        context.startActivity(intent);
    }
    /**
     * 跳转到item团购界面
     */
    public static void startGroupPurchase(Context context, String desc_url){
        desc_url = desc_url.substring(desc_url.length() - 5, desc_url.length());
        Intent intent = new Intent(context, ListViewActivity.class);
        intent.putExtra("url", desc_url);
        context.startActivity(intent);
    }
    /**
     * 打开团购界面
     */
    public static void startListViewActivity(Context context,String url){
        Intent intent = new Intent();
        intent.putExtra("url",url);
        intent.setClass(context, ListViewActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开新建收货地址界面
     */
    public static void startNewAddressActivity(Context context){
        Intent intent = new Intent();
        intent.setClass(context, NewAddressActivity.class);
        context.startActivity(intent);
    }
    /**
     * 打开修改收货地址界面
     */
    public static void startModificationAddressActivity(Context context,Serializable serializable){
        Intent intent = new Intent();
        intent.putExtra("address",serializable);
        intent.setClass(context, ModificationAddressActivity.class);
        context.startActivity(intent);
    }
    /**
     * 跳转到更多界面
     */
    public static void startHomeBoosActivity(Context context, String id){
        Intent intent = new Intent(context, HomeBoosActivity.class);
        intent.putExtra("id", id);
        context.startActivity(intent);
    }
}
